﻿@model XXN.Model.Model.Recommend
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Edit</title>

    <link href="~/lib/layui/css/layui.css" rel="stylesheet" />

    <script src="~/lib/layui/layui.js"></script>

    <script src="~/Scripts/jquery-1.8.0.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
</head>
<body>
    <div>
        <div class="layui-form-item">
            @using (Ajax.BeginForm("EditInfo", "Recommends", new AjaxOptions { OnSuccess = "EditComp" }))
            {
                <div class="layui-inline">
                    <label class="layui-form-label">@Html.Label("")</label>
                    <div class="layui-input-inline" lay-skin="primary" disabled>
                        @Html.TextBoxFor(m => m.Rec_id, new { @readonly = "readonly" })
                        @Html.ValidationMessageFor(m => m.Rec_id)
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">@Html.Label("商品")</label>
                    <div class="layui-input-inline">
                        @Html.TextBoxFor(m => m.Positionname)
                        @Html.ValidationMessageFor(m => m.Positionname)
                    </div>
                </div>

                <div>
                    <button class="layui-btn">立即提交</button>
                </div>
            }
        </div>

        <script>
            function EditComp(re) {
                if (re.success) {
                    parent.layui.layer.msg(re.msg);
                    //当你在iframe页面关闭自身时
                    parent.layui.$("#btnSearch").click();
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                } else {
                    alert(re.msg);
                }
            }
        </script>
    </div>
</body>
</html>